local fulong = fk.CreateSkill{
  name = "swis__fulong",
}

local fulong_mark = "@swis__fulong-turn"

Fk:loadTranslationTable{
  ["swis__fulong"] = "缚龙",
  [":swis__fulong"] = "每回合限两次，当你使用任意颜色的牌时，你可以一名角色摸一张牌，然后其不能使用此颜色的牌直到回合结束。",

  ["$swis__fulong1"] = "兵者，诡道也。",
  ["$swis__fulong2"] = "粮资军备，一览无遗。",

  ["#swis__fulong-ask"] = "缚龙：可以令一名角色摸一张牌，然后其不能使用或打出%arg牌直到回合结束。",
  [fulong_mark] = "缚龙",
}

fulong:addEffect(fk.CardUsing, {
  anim_type = "control",
  can_trigger = function (self, event, target, player, data)
    if player:usedSkillTimes(fulong.name) >= 2 then return false end
    if player == target and player:hasSkill(fulong.name) then
      return data.card.color ~= Card.NoColor
    end
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local color = data.card:getColorString()
    local tos = room:askToChoosePlayers(player, {
      targets = room:getAlivePlayers(false),
      min_num = 1,
      max_num = 1,
      cancelable = true,
      skill_name = fulong.name,
      prompt = "#swis__fulong-ask:::"..color,
    })
    if tos and #tos > 0 then
      event:setCostData(self, tos[1])
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    local to = event:getCostData(self) ---@type ServerPlayer
    to:drawCards(1, fulong.name)
    if player:isAlive() then
      local room = player.room
      room:addTableMark(to, fulong_mark, data.card:getColorString())
    end
  end
})

fulong:addEffect("prohibit", {
  prohibit_use = function(self, player, card)
    local mark = player:getTableMark(fulong_mark)
    return table.contains(mark, card:getColorString())
  end,
  prohibit_response = function(self, player, card)
    local mark = player:getTableMark(fulong_mark)
    return table.contains(mark, card:getColorString())
  end,
})

return fulong